<?
  include("com/website_config.php");
  $pathurltrue=__FILE__;
  $pathurl=basename($pathurltrue,".php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>留言-<? echo $title;?></title>
<link rel="shortcut icon" href="/favicon.ico"/>
<link href="css/css.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://www.ashlybus.com/js/jquery-1.9.1.min.js"></script>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?429d331d02551c5c42fbfb2982cfcf64"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head>
<body>
<? include("top.php");?>

<div class="jiange"></div>
<div class="nowplace">当前位置：<span><a href="/">首页</a></span><span>&nbsp;>&nbsp;</span>在线留言</div>

<div class="jiange"></div>
<div class="innerbox">
	<div class="innerleft fl">
          <div class="innerleft_title">关于我们</div>
          <ul>
              <li><a href="zerenxian.php>">公司简介</a></li>
			  <li><a href="yiwaixian.php>">联系我们</a></li>
			  <li><a class="now" href="guestbook.php>">在线留言</a></li>
			  <li><a href="driver.php>">司机风貌</a></li>
			  <li><a href="vote.php">满意度调查表</a></li>
          </ul>
     </div>
     <div class="newsleft2 fr">
          <div class="news_title">
          	<h2>在线留言</h2>
          	<div class="biaoqian"></div>
          </div>
       <div class="article_detail">
	   
<form action="com/guestbook_add.php" method="post" id="formMsg1" name="formMsg" onSubmit="return submitMsgBoard(this)">
<div class="yudizc">
<span>联 系 人<input type="text" name="contact" id="contact" class="inputt" size="22" tabindex="1" value="姓氏，例如:李小姐" style="color:#cccccc;" onFocus="ChangeStyle_hb(this,1,1)" onBlur="ChangeStyle_hb(this,2,1)"></span>
<input name="user_id" id="user_id" type="hidden" class="R_text1" size="30" value="0"/>
<span>联系方式<input type="text" name="contact_way" id="contact_way" class="inputt" size="22" tabindex="1" value="请留下手机号码" style="color:#cccccc;" onFocus="ChangeStyle_hb(this,1,2)" onBlur="ChangeStyle_hb(this,2,2)"></span>
<span>用车数量<input type="text" name="nums" id="nums" class="inputt" size="22" tabindex="1" value="请留下用车数量" style="color:#cccccc;" onFocus="ChangeStyle_hb(this,1,7)" onBlur="ChangeStyle_hb(this,2,7)"></span>
<span>使用车型<input type="text" name="models" id="models" class="inputt" size="22" tabindex="1" value="请填上几位客人或几座位车,一般不超过2位数" style="color:#cccccc;" onFocus="ChangeStyle_hb(this,1,3)" onBlur="ChangeStyle_hb(this,2,3)"></span>
<span>用车时间<input type="text" name="car_time" id="car_time" class="inputt" size="22" tabindex="1" value="请填上具体用车时间" style="color:#cccccc;" onFocus="ChangeStyle_hb(this,1,4)" onBlur="ChangeStyle_hb(this,2,4)"></span>
<span class="spbz">行程安排
<textarea name="details" id="details" rows="7" tabindex="4" onFocus="ChangeStyle_hb(this,1,5)" onBlur="ChangeStyle_hb(this,2,5)">包车用途及到达当地是否用车，请详细备明。</textarea>
</span>
<span class="spbz ydbz">备注<textarea name="note" id="note" rows="7" tabindex="4" onFocus="ChangeStyle_hb(this,1,6)" onBlur="ChangeStyle_hb(this,2,6)">未尽事宜，请备明！</textarea></span>

<span>验证码<input id="CheckCode" class="input2" maxlength="4" size="4" name="CheckCode" /></span>

<span class="checkcode"><img src="guestbook_code/imgcode.php" align="absmiddle" style="cursor: pointer;" onclick= this.src="guestbook_code/imgcode.php?"+Math.random() alt= "如果看不清楚，请刷新验证码" />
</span>

<input type="hidden" name="act" value="act_add_message" />
<span class="sptj"><input onclick="formMsg1();" name="submit" type="submit" id="submit" tabindex="2" value="预 定"></span>
</div>
</form>
	   	   
	   
	   </div>
       <div class="fenxiang"></div>
     </div>
     <div class="cl"></div>
</div>

<script type="text/javascript">
var msg_empty_email = "请输入您的电子邮件地址";
var msg_error_email = "电子邮件地址格式不正确";
var msg_title_empty = "留言标题为空";
var msg_content_empty = "留言内容为空";
var msg_captcha_empty = "验证码为空";
var msg_title_limit = "留言标题不能超过200个字";
var msg_empty_contact = "联系人不能为空";
var msg_contact_way_empty = "联系方式不能为空";
var msg_models_empty = "车型不能为空";
var msg_car_time_empty = "使用时间不能为空";
var msg_empty_details = "出发地及目的地不能为空";
var msg_details_empty = "详情不能为空";
var msg_user_email_empty = "请留下您的电子邮箱";

/**
 * 提交留言信息
*/
function submitMsgBoard(frm)
{
        var msg = new Object;

         msg.contact     = frm.elements['contact'].value;
         msg.contact_way = frm.elements['contact_way'].value;
         msg.user_id = frm.elements['user_id'].value;
         msg.user_email = frm.elements['user_email'].value;
         msg.car_time    = frm.elements['car_time'].value;
         msg.models     = frm.elements['models'].value;
         msg.details     = frm.elements['details'].value;  
         msg.nums = frm.elements['nums'].value;

        if (msg.user_id==0)
        {
          alert("您还不是我们的会员哦！\n请先注册或者登录成为我们会员!\n");
          window.location.href="/user.php";
          return false;
        }

        var msg_err = '';

        if (msg.contact.length == 0 || msg.contact=='请填写您的真实姓名')
        {
          msg_err += msg_empty_contact + '\n';
        }
        if (msg.contact_way.length == 0 || msg.contact_way=='请留下手机号码')
        {
          msg_err += msg_contact_way_empty  + '\n';
        }
        else
        {

            // var myreg = /^(((13[0-9]{1})|159|153)+\d{8})$/;
            if (msg.contact_way.length != 11)
            {
              msg_err += " 你留下的手机号码位数不正确" + '\n';
            }
            // else if(!myreg.test(msg.contact_way))
            // {
            //     msg_err += " 请输入有效的手机号码！" + '\n';
            // }

        }

        // if (msg.user_email.length == 0 || msg.user_email=='请留下您的电子邮箱')
        // {
        //   msg_err += msg_user_email_empty + '\n';
        // }
        // else
        // {
        //     var pattern = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
        //     if (!pattern.test(msg.user_email)) {  
        //         msg_err += " 请输入正确的邮箱地址" + '\n';
        //     }  
        // }

        function Iscx(cx){
          var recx=/^\d{1,2}$/;
          return(recx.test(cx));
        }

        if (msg.models.length == 0 || msg.models=='请填上几位客人或几座位车,一般不超过2位数')
        {
          msg_err += msg_models_empty + '\n';
        }
        else
        {
            if (!Iscx(msg.models)) {  
                msg_err += " 请准确填写车型的座位数,座位数一般不能超过2位数" + '\n';
            }  
        }

        if (msg.car_time.length == 0 || msg.car_time=='请填上具体用车时间')
        {
          msg_err += msg_car_time_empty + '\n';
        }
        if (msg.details.length == 0 || msg.details=='包车用途及到达当地是否用车，请详细备明。')
        {
          msg_err += msg_empty_details + '\n';
        }


        function IsNum(num){
          var reNum=/^\d*$/;
          return(reNum.test(num));
        }

        if (msg.nums.length == 0 || msg.nums=='请留下用车数量')
        {
          msg_err += "用车数量不能为空" + '\n';
        }
        else
        {
            if (!IsNum(msg.nums)) {  
                msg_err += " 请准确填写正确的数字" + '\n';
            }  
        }

        if (msg_err.length > 0)
        {
                alert(msg_err);
                return false;
        }
        else
        {
            if(frm.elements['note'].value=='未尽事宜，请备明！') frm.elements['note'].value='';
            return true;
        }
}
function ChangeStyle_hb(obj,typeid,strindex)
{
    var strobj=document.getElementById(obj.id);
    //alert(strobj.value);
    if(strobj!=null)
    {
        if(typeid==1)
        {
            strobj.style.border="1px solid #3366CC";
            strobj.style.color="#000000";
            switch(strindex)
            {
                case 1:
                    if(strobj.value=="请填写您的真实姓名")
                    {
                        strobj.value="";
                    }
                    break;
                case 2:
                    if(strobj.value=="请留下手机号码")
                    {
                        strobj.value="";
                    }
                    break;
                case 3:
                    if(strobj.value=="请填上几位客人或几座位车,一般不超过2位数")
                    {
                        strobj.value="";
                    }
                    break;
                case 4:
                    if(strobj.value=="请填上具体用车时间")
                    {
                        strobj.value="";
                    }
                    break;
                case 5: 
                    if(strobj.value=="包车用途及到达当地是否用车，请详细备明。")
                    {
                        strobj.value="";
                    }
                    break;
                case 6: 
                    if(strobj.value=="未尽事宜，请备明！")
                    {
                        strobj.value="";
                    }
                    break;
                case 7: 
                    if(strobj.value=="请留下用车数量")
                    {
                        strobj.value="";
                    }
                    break;
                case 8: 
                    if(strobj.value=="请留下您的电子邮箱")
                    {
                        strobj.value="";
                    }
                    break;
            }   
         }
        if(typeid==2)
        {
            strobj.style.border="1px solid #BBBBBB";
            strobj.style.color="#CCCCCC";
            switch(strindex)
            {
                case 1:
                    if(strobj.value=="")
                    {
                        strobj.value="请填写您的真实姓名";
                    }
                    break;
                case 2:
                    if(strobj.value=="")
                    {
                        strobj.value="请留下手机号码";
                    }
                    break;
                case 3:
                    if(strobj.value=="")
                    {
                        strobj.value="请填上几位客人或几座位车,一般不超过2位数";
                    }
                    break;
                case 4:
                    if(strobj.value=="")
                    {
                        strobj.value="请填上具体用车时间";
                    }
                    break;
                case 5: 
                    if(strobj.value=="")
                    {
                        strobj.value="包车用途及到达当地是否用车，请详细备明。";
                    }
                    break;
                case 6: 
                    if(strobj.value=="")
                    {
                        strobj.value="未尽事宜，请备明！";
                    }
                    break;
                case 7: 
                    if(strobj.value=="")
                    {
                        strobj.value="请留下用车数量";
                    }
                    break;
                case 8: 
                    if(strobj.value=="")
                    {
                        strobj.value="请留下您的电子邮箱";
                    }
                    break;
            }  
        }
    }
     
}
</script>
<? include("foot.php");?>
</body>
</html>